package com.demo.bean.scope.controller;

import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author peter
 * @date 2021/11/21 上午13:22
 */
@RestController
@Slf4j
@RequestMapping("/request")
@Scope("request")
public class RequestTestController {

    private int num = 0;
    private static int staticNum = 0;

    @GetMapping("/add1")
    public String add1() {
        String result = StrUtil.format("int {}, static {}", ++num, ++staticNum);
        log.info(result);
        return result;
    }

    @GetMapping("/add2")
    public String add2() {
        String result = StrUtil.format("int {}, static {}", ++num, ++staticNum);
        log.info(result);
        return result;
    }
}
